home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK2.toast / Development Kits (Disc 2) / OpenDoc / OpenDoc Development / Debugging Support / OpenDoc™ Source Code / Core / ODObject.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1996-08-28  |  5.7 KB  |  202 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        ODObject.cp
  3.  
  4.     Contains:    Definition of class ODObject
  5.  
  6.     Owned by:    Vincent Lo
  7.  
  8.     Copyright:    © 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  9.  
  10.     Change History (most recent first):
  11.  
  12.          <2>      6/6/96    jpa        T10020: Added fn prefix to metaclass to
  13.                                     avoid CW compiler warnings.
  14.         <12>     8/26/95    TÇ        1273191 Lets eliminate
  15.                                     ODObject::IsInitialized
  16.         <11>     5/26/95    RR        #1251403: Multithreading naming support
  17.         <10>      5/4/95    eeh        1243497: make ReleaseExtension raise
  18.                                     exception
  19.          <9>     4/26/95    CG        1211082 BB: 5$ Bugs need to be evaluated
  20.                                     and removed from Core
  21.          <8>     9/14/94    jpa        ODValidatePtr --> MMValidatePtr [1186692]
  22.          <7>     8/31/94    TÇ        #1183129, #1183116, #1183119, #1183111:
  23.                                     Lots of ErrorCode cleanup.
  24.          <6>     8/17/94    jpa        Tore out THROW on SubClassResponsibility:
  25.                                     we cannot throw out of SOM methods!!!
  26.          <5>     8/17/94    jpa        Warn when deleting problematic object
  27.                                     (block not marked as SOM object) [1181510]
  28.          <4>     8/12/94    VL        Added IsEqualTo.
  29.          <3>     7/21/94    VL        SubClassResponsibility should THROW instead
  30.                                     of WARN.
  31.          <2>      7/8/94    VL        Added warn to SubClassResponsibility.
  32.          <1>     6/22/94    CG        first checked in
  33.          <0>     6/21/94    SV        SOMverted
  34.          <9>     5/27/94    MB        #1162181: Fixed MMM integration bug
  35.          <8>      5/9/94    MB        #1162181: Changes necessary to install MMM.
  36.          <7>     3/25/94    MB        Symantec ASLM fixes. #1150864
  37.          <6>     3/15/94    MB        Changes to support SCpp/ASLM builds,
  38.                                     #1150864.
  39.          <5>     2/25/94    TÇ        comment/ifdef the validate object stuff
  40.          <4>     2/22/94    CC        Moved GetFirstObject here for ASLM.
  41.          <3>     2/22/94    VL        Added include for ODMemory.
  42.          <2>     2/22/94    VL        Added support for object list.
  43.         <11>      2/8/94    TÇ        Throw -> THROW & some code clean up
  44.         <10>     1/11/94    TÇ        Init... changes
  45.          <9>    12/15/93    TÇ        InitObject changes
  46.          <8>     12/3/93    TÇ        Stop including ODError.h, it is included
  47.                                     as ErrorDef.h inside Except.h
  48.          <7>    11/11/93    TÇ        Throw(kODErrUnsupportedExtension) in
  49.                                     GetExtension
  50.          <6>      8/9/93    PH        Segmentation
  51.          <5>     6/16/93    VL        Moved ODRefCntObject and
  52.                                     ODPersistentObject to their own files.
  53.          <4>     6/10/93    NP        Changed some parameter types to ODType.
  54.          <3>      5/6/93    NP        Added Initialize method.
  55.          <2>     4/29/93    TÇ        change names of includefiles
  56.          <1>     4/26/93    RCR        first checked in
  57.  
  58.     To Do:
  59. */
  60.  
  61. #ifndef _PLFMDEF_
  62. #include "PlfmDef.h"
  63. #endif
  64.  
  65.  
  66. #define ODObject_Class_Source
  67. #define VARIABLE_MACROS
  68. #include <ODObject.xih>
  69.  
  70. #ifndef _EXCEPT_
  71. #include "Except.h"
  72. #endif
  73.  
  74. #ifndef _ODMEMORY_
  75. #include <ODMemory.h>
  76. #endif
  77.  
  78.  
  79. #pragma segment ODObject
  80.  
  81.  
  82. #if ODDebug
  83.  
  84. #ifndef _ODMEMORY_
  85. #include <ODMemory.h>
  86. #endif
  87.  
  88. #ifndef _MEMDEBG_
  89. #include <MemDebg.h>
  90. #endif
  91.  
  92. SOM_Scope ODObject*     SOMLINK ODObject_fFirst = kODNULL;
  93.  
  94. #endif
  95.  
  96. SOM_Scope void  SOMLINK ODObjectInitObject(ODObject *somSelf, Environment *ev)
  97. {
  98.     //ODObjectData *somThis = ODObjectGetData(somSelf);
  99.     ODObjectMethodDebug("ODObject","InitObject");
  100. }
  101.  
  102.  
  103. SOM_Scope ODBoolean     SOMLINK ODObjectHasExtension(ODObject *somSelf, Environment *ev,
  104.         ODType extensionName)
  105. {
  106. //    ODObjectData *somThis = ODObjectGetData(somSelf);
  107.     ODObjectMethodDebug("ODObject","HasExtension");
  108.  
  109. ODUnused(extensionName);
  110.     return kODFalse;
  111. }
  112.  
  113.  
  114. SOM_Scope ODExtension*     SOMLINK ODObjectAcquireExtension(ODObject *somSelf, Environment *ev,
  115.         ODType extensionName)
  116. {
  117. //    ODObjectData *somThis = ODObjectGetData(somSelf);
  118.     ODObjectMethodDebug("ODObject","AcquireExtension");
  119.  
  120. ODUnused(extensionName);
  121.     ODSetSOMException(ev,kODErrUnsupportedExtension);
  122.     return kODNULL;
  123. }
  124.  
  125. SOM_Scope void     SOMLINK ODObjectReleaseExtension(ODObject *somSelf, Environment *ev,
  126.         ODExtension* extension)
  127. {
  128. //  ODObjectData *somThis = ODObjectGetData(somSelf);
  129.     ODObjectMethodDebug("ODObject","ReleaseExtension");
  130.  
  131. ODUnused(extension);
  132.     ODSetSOMException(ev, kODErrUnsupportedExtension );
  133. }
  134.  
  135. SOM_Scope ODSize  SOMLINK ODObjectPurge(ODObject *somSelf, Environment *ev,
  136.         ODSize size)
  137. {
  138. //    ODObjectData *somThis = ODObjectGetData(somSelf);
  139.     ODObjectMethodDebug("ODObject","Purge");
  140.  
  141.     return 0;
  142. }
  143.  
  144. SOM_Scope ODBoolean  SOMLINK ODObjectIsEqualTo(ODObject *somSelf, Environment *ev,
  145.         ODObject* object)
  146. {
  147. //    ODObjectData *somThis = ODObjectGetData(somSelf);
  148.     ODObjectMethodDebug("ODObject","IsEqualTo");
  149.  
  150.     return (somSelf == object ? kODTrue : kODFalse);
  151. }
  152.  
  153. SOM_Scope void  SOMLINK ODObjectSubClassResponsibility(ODObject *somSelf, Environment *ev)
  154. {
  155. //    ODObjectData *somThis = ODObjectGetData(somSelf);
  156.     ODObjectMethodDebug("ODObject","SubClassResponsibility");
  157.  
  158.     WARN("A subclass should have overridden this method!");
  159.     ODSetSOMException(ev,kODErrSubClassResponsibility, "SubClass Responsibility");
  160. }
  161.  
  162. SOM_Scope void  SOMLINK ODObjectsomInit(ODObject *somSelf)
  163. {
  164.     ODObjectMethodDebug("ODObject","somInit");
  165.  
  166.     ODObject_parent_SOMObject_somInit(somSelf);
  167.     
  168.     ODBlockIsObject(somSelf,kODTrue);    // Inform memory mgr this is an object
  169. }
  170.  
  171. SOM_Scope void  SOMLINK ODObjectsomUninit(ODObject *somSelf)
  172. {
  173.     ODObjectMethodDebug("ODObject","somUninit");
  174.  
  175. #if ODDebug
  176.     if( !ODIsBlockAnObject(somSelf) ) {
  177.         // It's not marked in the heap as a SOM object. What's wrong?
  178.         if( !MMValidatePtr(somSelf,kODTrue,"somUninit") )
  179.             return;
  180.         else if( !somIsObj(somSelf) ) {
  181.             WARN("somUninit called on non-SOM-object %p",somSelf);
  182.             return;
  183.         } else
  184.             WARN("Block %p mistakenly not marked as SOM object",somSelf);
  185.     }
  186. #endif
  187.  
  188.     ODBlockIsObject(somSelf,kODFalse);    // This is no longer an object
  189.  
  190.     ODObject_parent_SOMObject_somUninit(somSelf);
  191. }
  192.  
  193. SOM_Scope SOMObject*  SOMLINK M_ODObjectsomNew(M_ODObject *somSelf)
  194. {
  195.     // 1242632 Why do we need this method? It doesn't do anything but call its parent!
  196.     
  197.     /* M_ODObjectData *somThis = M_ODObjectGetData(somSelf); */
  198.     M_ODObjectMethodDebug("M_ODObject","somNew");
  199.  
  200.     return (M_ODObject_parent_SOMClass_somNew(somSelf));
  201. }
  202.